//
//  PKHomeViewControllerLiveCell.swift
//  Panku
//
//  Created by mac on 2017/2/7.
//  Copyright © 2017年 Monster. All rights reserved.
//

import UIKit
import SnapKit
import FXImageView

class PKHomeViewControllerLiveCell: PKBaseTableViewCell {
    
    //MARK: -properties
    lazy var avatarView = UIImageView()
    lazy var nameLabel = UILabel()
    lazy var descLabel = UILabel()
    lazy var idLabel = UILabel()
    lazy var personCountLabel = UILabel()
    lazy var liveView = UIImageView()


    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    //初始化Cell
    override func setupCell() {
        
        //设置背景为白色
        contentView.backgroundColor = UIColor.white
        
        //addSubViews
        contentView.addSubview(avatarView)
        contentView.addSubview(nameLabel)

        contentView.addSubview(personCountLabel)
        contentView.addSubview(liveView)
        contentView.addSubview(descLabel)
        contentView.addSubview(idLabel)
        
        avatarView.image = R.image.mine_logo()
        avatarView.layer.masksToBounds = true
        avatarView.layer.cornerRadius = 20
        avatarView.layer.borderColor = UIColor.black.cgColor
        avatarView.layer.borderWidth = 1
        avatarView.snp.makeConstraints { (make) in
            make.top.equalTo(contentView.snp.top).offset(10)
            make.left.equalTo(contentView.snp.left).offset(10)
            make.width.equalTo(40)
            make.height.equalTo(40)
        }
        
        nameLabel.textColor = UIColor(hexString: "666666")
        nameLabel.font = UIFont.PKFont(Size: 14)
        nameLabel.text = "未知"
        nameLabel.snp.makeConstraints { (make) in
            make.top.equalTo(contentView.snp.top).offset(7)
            make.left.equalTo(avatarView.snp.right).offset(10)
            
        }
        
        descLabel.text = "随便说说随便说说随便说说随便说说"
        descLabel.textColor = UIColor(hexString: "BCBCBC")
        descLabel.font = UIFont.PKFont(Size: 11)
        descLabel.snp.makeConstraints { (make) in
            make.top.equalTo(nameLabel.snp.bottom).offset(7)
            make.left.equalTo(nameLabel.snp.left)
            
        }
        
        personCountLabel.font = UIFont.PKFont(Size: 14)
        personCountLabel.textColor = UIColor(hexString: "959595")
        personCountLabel.text = "2000人观看"
        personCountLabel.snp.makeConstraints { (make) in
            make.top.equalTo(nameLabel.snp.top)
            make.right.equalTo(contentView.snp.right).offset(-10)
        }
        
        liveView.image = R.image.banner2()
        liveView.contentMode = .scaleAspectFill
        liveView.layer.masksToBounds = true
        liveView.snp.makeConstraints { (make) in
            make.left.equalTo(contentView.snp.left)
            make.right.equalTo(contentView.snp.right)
            make.bottom.equalTo(contentView.snp.bottom)
            make.top.equalTo(contentView.snp.top).offset(55)
        }
        
        
        idLabel.text = "ID90527"
        idLabel.textColor = UIColor(hexString:"B6B6B6")
        idLabel.font = UIFont.PKFont(Size: 12)
        idLabel.snp.makeConstraints { (make) in
            make.right.equalTo(personCountLabel.snp.right)
            make.centerY.equalTo(descLabel.snp.centerY)
        }
    }

}
